<%--@elvariable id="webRoot" type="com.doupi.partner.op.interceptor.OpFilter"--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../../common/tags.jsp" %>

<!DOCTYPE html>
<html>
<head lang="en">
    <%@include file="../../common/assets.jsp" %>
</head>
<body>
<!-- header -->
<%@include file="../../common/header.jsp" %>

<!-- main start -->
<div class="am-cf admin-main">
    <!-- sidebar start -->
    <%@include file="../../common/menu.jsp" %>
    <!-- sidebar end -->

    <!-- main start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">系统配置</strong> /
                    <small>管理员编辑</small>
                </div>
            </div>

            <hr>
            <form action="${webRoot}/configure/administrator/save" method="POST" id="administrator-edit-form">
                <input type="hidden" name="id" value="${administrator.id}">

                <div class="am-tabs am-margin" data-am-tabs="">
                    <ul class="am-tabs-nav am-nav am-nav-tabs">
                        <li class="am-active">
                            <a href="#tab-base-info">基本信息</a>
                        </li>
                    </ul>


                    <div class="am-tabs-bd" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">

                        <%--基本信息--%>
                        <div class="am-tab-panel am-in am-active am-form" id="tab-base-info">
                            <div class="am-g am-margin-top">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">姓名</div>
                                <div class="am-u-sm-8 am-u-md-10">
                                    <input type="text" class="am-input-sm" name="name" value="${administrator.name}">
                                </div>
                            </div>

                            <div class="am-g am-margin-top">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">手机号</div>
                                <div class="am-u-sm-8 am-u-md-10">
                                    <input type="text" name="mobile" class="am-input-sm" value="${administrator.mobile}">
                                </div>
                            </div>

                            <div class="am-g am-margin-top">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">密码</div>
                                <div class="am-u-sm-8 am-u-md-10">
                                    <input type="password" name="password" class="am-input-sm" value="">
                                </div>
                            </div>

                            <div class="am-g am-margin-top">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">状态</div>
                                <div class="am-u-sm-8 am-u-md-10">
                                    <select name="status" class="am-input-sm">
                                        <option value="1" <c:if test="${administrator.status == 1}">selected</c:if>>正常
                                        </option>
                                        <option value="99"
                                                <c:if test="${administrator.status == 99}">selected</c:if>>锁定
                                        </option>
                                    </select>
                                </div>
                            </div>

                            <div class="am-g am-margin-top">
                                <div class="am-u-sm-4 am-u-md-2 am-text-right">角色</div>
                                <div class="am-u-sm-8 am-u-md-10">
                                    <c:forEach items="${administratorRoles }" var="item" varStatus="st">
                                        <c:set value="" var="checked"></c:set>
                                        <c:forEach items="${administratorHasRoles }" var="role">
                                            <c:if test="${role.administratorRoleId == item.id }">
                                                <c:set value="checked" var="checked"></c:set> </c:if> </c:forEach>
                                        <label class="am-checkbox-inline">
                                            <input type="checkbox" value="${item.id }" name="administratorHasRoles[${st.index }].administratorRoleId" data-am-ucheck ${checked }>
                                                ${item.name }
                                        </label> </c:forEach>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>

                <div class="am-margin">
                    <button type="submit" class="am-btn am-btn-primary am-btn-xs">保存</button>
                    <button type="button" class="am-btn am-btn-primary am-btn-xs" onclick="history.go(-1)">关闭</button>
                </div>
            </form>
        </div>

    </div>

    <!-- main end -->

    <!-- foot -->

    <%@include file="../../common/footer.jsp" %>


    <script src="${webRoot}/assets/js/ueditor/ueditor.config.js"></script>
    <script src="${webRoot}/assets/js/ueditor/ueditor.all.min.js"></script>

    <script type="text/javascript">
        $(function () {

            //关闭自动完成
            $('input:text').attr('autocomplete', 'off');

            //初始化呢图片上传控件
            initUploadify({
                id: "administratorImg",
                auto: true,
                type: 'administrator'
            }, function (file, dataStr, response) {
                var data = JSON.parse(dataStr);
                var url = data.url;
                var parent = $('#administratorImg').closest('.am-g');
                parent.find(':hidden[name=url]').val(url);
                parent.next('.am-g').find('img').attr('src', url);
                layer.msg('上传成功');
            }, function () {
                layer.msg('上传失败');
            });
        });
    </script>
</body>
</html>